﻿@using CloudNimble.BlazorEssentials.TestApp.ViewModels;
@using CloudNimble.BlazorEssentials.Controls;
@using System.ComponentModel;

@page "/"

@inject ConfigurationBase config
@inject AppState appState
@inject IndexViewModel viewModel

<h1>Hello, world!</h1>
<p>Welcome to your new app. </p>

<SurveyPrompt Title="How is Blazor working for you?" />

<h3>Injected Configuration:</h3>
<p>ApiRoot: "@config.ApiRoot"</p>

@code
{
    protected override async Task OnInitializedAsync()
    {
        viewModel.StateHasChangedAction = StateHasChanged;
        viewModel.PropertyChanged += (sender, e) =>
        {
            this.StateHasChanged();
        };

        await viewModel.Load();
    }

}